// pages/my/myOrderAdminDetail/myOrderAdminDetail.js
const App = getApp();
const utils = require('../../../utils/util.js')
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getDataDetail(options.id)
  },
  getDataDetail:function (fahuoid) {
    utils.requestUrl({
      url:'/niu/apiv3/fahuo_getdetail.php',
      params:{
        markid:wx.getStorageSync('markId'),
        fahuoid:fahuoid
      }
    }).then((res) =>{
      console.log(res.data);
      let data = res.data
      let time = utils.subTime(data.time)
      let orderNum = data.time.substring(2,6)+'00'+data.id
      this.setData({
        danhao:data.danhao,
        extra1:data.extra1,
        extra2:data.extra2,
        extra3:data.extra3,
        usercomment:data.usercomment,
        kdtype:data.kdtype,
        state:data.state,
        time:time,
        orderNum:orderNum,
        toys:data.toys
      })
    })
  },
  goToDetail:function (e){
    let id = e.currentTarget.dataset.id
    wx.navigateTo({
      url: '/pages/my/myIndexDetail/myIndexDetail?id='+id,
    })
  },
  gotoLogisticInfo:function () {
    let danhao = this.data.danhao;
    let orderNum = this.data.orderNum;
    wx.navigateTo({
      url: '/pages/my/logisticsInfo/logisticsInfo?kdno='+danhao+'&djNum='+orderNum,
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  }
})